<?php
switch($action) {
case userSend;
	userSend();
	break;
case infos;
	infos();
	break;
}


/* 用户意见反馈*/
function userSend() {
	global $config,$userInfo;
	if(_g('submit')) {
		$data['suid'] = $userInfo['uid'];
		$data['comment'] = trim(_g('comment'));
		if(empty($data['comment'])) {
			$message = array(
				'status' => '',
				'msg' => '正文消息不能为空',
			);
			echo json_encode($message);
			exit;
		}
		$data['cdate'] = date("Y-m-d H:i:s");
		$data['remind'] = trim(_g('remind'));
		$message = new Message();
		$message->addBug($data);
		$message = array(
			'status' => 'success',
		);
		echo json_encode($message);
		exit;
	}
	include template('manage/userSend');
}

/* 用户个人信息*/
function infos() {
	global $config,$userInfo;
	if(_g('submit')) {
		$password = trim(_g('password'));
		if($password !='******') {
			$data['userPassword'] = $password;
		}
		$data['email'] = trim(_g('email'));
		$findkey = "email ='".$data['email']."'";
		$findkey = "uid !='".$userInfo['uid']."'";
		$erro = $user->getUser(1,1,$findkey,$order='uid',$fields='*');
		if(!empty($erro)) {
			$message = array(
				'status' => 'error',
				'msg' => '邮箱有冲突:请更换一个电子邮箱',
			);
			echo json_encode($message);
			exit;
		}
		$user = new User();
		$data = $user->saveEdit($data,$userInfo['uid']);
		$message = array(
			'status' => 'success',
		);
		echo json_encode($message);
		exit;
	}
	include template('manage/infos');
}

?>